/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ru.ibrae.mchs.radiation.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author murr
 */
@Entity
@Table(name = "cross_zon")
@NamedQueries({
    @NamedQuery(name = "CrossZon.findAll", query = "SELECT c FROM CrossZon c"),
    @NamedQuery(name = "CrossZon.findByIdNp", query = "SELECT c FROM CrossZon c WHERE c.crossZonPK.idNp = :idNp"),
    @NamedQuery(name = "CrossZon.findByIdZon", query = "SELECT c FROM CrossZon c WHERE c.crossZonPK.idZon = :idZon"),
    @NamedQuery(name = "CrossZon.findByDateZon0", query = "SELECT c FROM CrossZon c WHERE c.crossZonPK.dateZon0 = :dateZon0"),
    @NamedQuery(name = "CrossZon.findByDateZonn", query = "SELECT c FROM CrossZon c WHERE c.dateZonn = :dateZonn"),
    @NamedQuery(name = "CrossZon.findByActualZon", query = "SELECT c FROM CrossZon c WHERE c.actualZon = :actualZon")})
public class CrossZon implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CrossZonPK crossZonPK;
    @Column(name = "DATE_ZONN")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateZonn;
    @Column(name = "ACTUAL_ZON")
    private Boolean actualZon;
    @JoinColumn(name = "ID_IST", referencedColumnName = "ID_IST")
    @ManyToOne
    private DicIst dicIst;
    @JoinColumn(name = "ID_ZON", referencedColumnName = "ID_ZON", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private DicZon dicZon;
    @JoinColumn(name = "ID_NP", referencedColumnName = "ID_NP", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Geoobject geoobject;

    public CrossZon() {
    }

    public CrossZon(CrossZonPK crossZonPK) {
        this.crossZonPK = crossZonPK;
    }

    public CrossZon(int idNp, int idZon, Date dateZon0) {
        this.crossZonPK = new CrossZonPK(idNp, idZon, dateZon0);
    }

    public CrossZonPK getCrossZonPK() {
        return crossZonPK;
    }

    public void setCrossZonPK(CrossZonPK crossZonPK) {
        this.crossZonPK = crossZonPK;
    }

    public Date getDateZonn() {
        return dateZonn;
    }

    public void setDateZonn(Date dateZonn) {
        this.dateZonn = dateZonn;
    }

    public Boolean getActualZon() {
        return actualZon;
    }

    public void setActualZon(Boolean actualZon) {
        this.actualZon = actualZon;
    }

    public DicIst getDicIst() {
        return dicIst;
    }

    public void setDicIst(DicIst dicIst) {
        this.dicIst = dicIst;
    }

    public DicZon getDicZon() {
        return dicZon;
    }

    public void setDicZon(DicZon dicZon) {
        this.dicZon = dicZon;
    }

    public Geoobject getGeoobject() {
        return geoobject;
    }

    public void setGeoobject(Geoobject geoobject) {
        this.geoobject = geoobject;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (crossZonPK != null ? crossZonPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CrossZon)) {
            return false;
        }
        CrossZon other = (CrossZon) object;
        if ((this.crossZonPK == null && other.crossZonPK != null) || (this.crossZonPK != null && !this.crossZonPK.equals(other.crossZonPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "JPAtest.entities.CrossZon[crossZonPK=" + crossZonPK + "]";
    }

}
